{extend name="property/public/insidePageBase" /}
{block name="title"}订单支付详情{/block}
{block name="css"}
{__block__}
<style>
    body{
        margin:0;
    }
    .layui-iconpicker-body.layui-iconpicker-body-page .hide {display: none;}
    body .layui-iconpicker .layui-iconpicker-icon-item{
        width: 20.1%;
    }
    body{
        background-color: #ffffff;
    }
</style>
<style>
    .layui-upload-img-box {
        float:left;
        margin-bottom: 2px;
        margin-right: 2px;
        background: #e0e0e0;
        padding: 1px;
    }
    .layui-upload-img {
        width: 82px;
        height: 82px;
        margin-bottom: 1px;
    }
</style>
{/block}
{block name="body"}
<div class="layuimini-container">
    <div class="layuimini-main">
        <div class="layui-form  layui-form-pane">
            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                <div class="layui-tab layui-tab-brief">
                    <!--基本信息 add-->
                    <div class="layui-row">
                        <div class="layui-col-xs4">
                            <div class="layui-form-item">
                                <label class="layui-form-label">账单编号</label>
                                <div class="layui-input-block">
                                    <input type="text"  value="{$info['number']??''}" disabled autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-xs4">
                            <div class="layui-form-item">
                                <label class="layui-form-label">开始日期</label>
                                <div class="layui-input-block">
                                    <input type="text"  value="{$info['start_date']??''}" disabled autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-xs4">
                            <div class="layui-form-item">
                                <label class="layui-form-label">截至日期</label>
                                <div class="layui-input-block">
                                    <input type="text"  value="{$info['end_date']??''}" disabled autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-row">
                        <div class="layui-col-xs4">
                            <div class="layui-form-item">
                                <label class="layui-form-label">付款用户</label>
                                <div class="layui-input-block">
                                    <input type="text"  value="{$info['pay_username']??''}" disabled autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-xs4">
                            <label class="layui-form-label">支付时间</label>
                            <div class="layui-input-block">
                                <input type="text"  value="{$info['pay_time']??''}" disabled autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-col-xs4">
                            <div class="layui-form-item">
                                <label class="layui-form-label">支付金额</label>
                                <div class="layui-input-block">
                                    <input type="text"  value="{$info['pay_amount']??''}" disabled autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-row">
                        <div class="layui-col-xs4">
                            <div class="layui-form-item">
                                <label class="layui-form-label">确认用户</label>
                                <div class="layui-input-block">
                                    <input type="text"  value="{$info['check_username']??''}" disabled autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-xs4">
                            <label class="layui-form-label">确认时间</label>
                            <div class="layui-input-block">
                                <input type="text"  value="{$info['check_time']??''}" disabled autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-col-xs4">
                            <div class="layui-form-item">
                                <label class="layui-form-label">确认金额</label>
                                <div class="layui-input-block">
                                    <input type="text"  value="{$info['check_amount']??''}" disabled autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-row">
                        <div class="layui-col-xs4">
                            <div class="layui-form-item">
                                <label class="layui-form-label">对账用户</label>
                                <div class="layui-input-block">
                                    <input type="text"  value="{$info['affirm_username']??''}" disabled autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-xs4">
                            <label class="layui-form-label">对账时间</label>
                            <div class="layui-input-block">
                                <input type="text"  value="{$info['affirm_time']??''}" disabled autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-col-xs4">
                            <div class="layui-form-item">
                                <label class="layui-form-label">对账金额</label>
                                <div class="layui-input-block">
                                    <input type="text"  value="{$info['affirm_amount']??''}" disabled autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-row">
                        <div class="layui-col-xs6">
                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label">支付方式 &nbsp; &nbsp;
                                    <b>
                                        {if $info['pay_type'] == 1} <span class="layui-badge layui-bg-red">线上</span>{/if}
                                        {if $info['pay_type'] == 2} <span class="layui-badge layui-bg-royalblue">线下</span>{/if}

                                        {if $info['pay_method'] == 1} <span class="layui-badge layui-bg-orange">微信</span>{/if}
                                        {if $info['pay_method'] == 2} <span class="layui-badge layui-bg-blue">支付宝</span>{/if}
                                        {if $info['pay_method'] == 3} <span class="layui-badge layui-bg-cyan">银联</span>{/if}
                                        {if $info['pay_method'] == 4} <span class="layui-badge layui-bg-green">现金</span>{/if}
                                        {if $info['pay_method'] == 5} <span class="layui-badge layui-bg-reg">企业微信</span>{/if}
                                    </b>
                                </label>
                                <div class="layui-input-block">
                                    <textarea placeholder="付款信息备备" class="layui-textarea" disabled>{$info['content']??''}</textarea>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-xs6">
                            <div class="layui-row">
                                <div class="layui-form-item layui-form-text">
                                    <label class="layui-form-label">支付凭证</label>
                                </div>
                                <div class="layui-form-item layui-form-text">
                                    <div class="layui-input-block">
                                        <div class="layui-upload-list">
                                            {foreach $info['picture'] as $k=>$v}
                                            <div class="layui-upload-img-box" id="{:md5($v)}-{$k}">
                                                <img src="{$v}" class="layui-upload-img checkPictureByImg">
                                            </div>
                                            {/foreach}
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>


                    {if $info['check_type'] == 1}
                    <button type="button" class="layui-btn layui-btn-fluid checkPayMomey">收款确认</button>
                    {/if}

                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">确认备注信息 &nbsp; &nbsp;
                            <b>
                                {if $info['check_method'] == 1} <span class="layui-badge layui-bg-red">自动</span>{/if}
                                {if $info['check_method'] == 2} <span class="layui-badge layui-bg-royalblue">人工</span>{/if}

                                {if $info['check_type'] == 1} <span class="layui-badge layui-bg-orange">待确认</span>{/if}
                                {if $info['check_type'] == 2} <span class="layui-badge layui-bg-blue">确认失败</span>{/if}
                                {if $info['check_type'] == 3} <span class="layui-badge layui-bg-cyan">确认成功</span>{/if}
                            </b>
                        </label>
                        <div class="layui-input-block">
                            <textarea placeholder="确认信息备注" class="layui-textarea" disabled>{$info['check_remark']??''}</textarea>
                        </div>
                    </div>
                    {if $info['affirm_type'] == 1}
                    <button type="button" class="layui-btn layui-btn-fluid affirmPayMomey">对账确认</button>
                    {/if}


                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">对账备注信息 &nbsp; &nbsp;
                            <b>
                                {if $info['affirm_type'] == 1} <span class="layui-badge layui-bg-orange">待确认</span>{/if}
                                {if $info['affirm_type'] == 2} <span class="layui-badge layui-bg-blue">确认失败</span>{/if}
                                {if $info['affirm_type'] == 3} <span class="layui-badge layui-bg-cyan">确认成功</span>{/if}
                            </b>
                        </label>
                        <div class="layui-input-block">
                            <textarea placeholder="对账信息备注" class="layui-textarea" disabled>{$info['affirm_remark']??''}</textarea>
                        </div>
                    </div>

                    <!--基本信息 add-->
            </div>
        </div>
    </div>
</div>
{/block}
{block name="js"}
{__block__}
<script>
    layui.use(['layer'], function () {
        var layer = layui.layer;
        let courseId = {$info['id']};
        // 收款确认 ADD
        $('.checkPayMomey').on('click', function() {
            var url = '{:url("propertyBillCourseCheck")}?id='+courseId;
            var index = layer.open({title: '收款确认', type: 2, shade: 0.2,maxmin:true, area:['600px', '450px'], content: url, btnAlign: 'c', btn: ['确定', '取消'], yes: function (index, layero) {
                    var iframeWindow = window['layui-layer-iframe' + index], submit = layero.find('iframe').contents().find("#submitBtn");
                    iframeWindow.layui.form.on('submit(submitBtn)', function (data) {
                        var field = data.field; //获取提交的字段
                        var loadAdd = layer.msg('提交中', {icon: 16, time: 0, shade: 0.1, offset: '15px'});
                        $.post(url, field, function (res) {
                            layer.close(loadAdd);
                            if (res.code === 0) {
                                layer.close(index); //关闭弹层
                                location.reload();
                                layer.msg(res.msg, {icon: 6, offset: '15px'});
                            } else {
                                layer.msg(res.msg, {icon: 5, offset: '15px'});
                            }
                        });
                    });
                    submit.trigger('click');
                }
            });
        });
        // 收款确认 END
        // 对账确认 ADD
        $('.affirmPayMomey').on('click', function() {
            var url = '{:url("propertyBillCourseAffirm")}?id='+courseId;
            var index = layer.open({title: '对账确认', type: 2, shade: 0.2,maxmin:true, area:['600px', '450px'], content: url, btnAlign: 'c', btn: ['确定', '取消'], yes: function (index, layero) {
                    var iframeWindow = window['layui-layer-iframe' + index], submit = layero.find('iframe').contents().find("#submitBtn");
                    iframeWindow.layui.form.on('submit(submitBtn)', function (data) {
                        var field = data.field; //获取提交的字段
                        var loadAdd = layer.msg('提交中', {icon: 16, time: 0, shade: 0.1, offset: '15px'});
                        $.post(url, field, function (res) {
                            layer.close(loadAdd);
                            if (res.code === 0) {
                                layer.close(index); //关闭弹层
                                location.reload();
                                layer.msg(res.msg, {icon: 6, offset: '15px'});
                            } else {
                                layer.msg(res.msg, {icon: 5, offset: '15px'});
                            }
                        });
                    });
                    submit.trigger('click');
                }
            });
        });
        // 对账确认 END
    });
</script>
{/block}